<template>
  <div class="login">
    <div class="pic">
      <div class="iconfont icon-arrow-left-bold" @click="goBack"></div>
      <img src="../../assets/register.jpg" alt="">
    </div>
    <van-form @submit="onSubmit">
      <van-cell-group inset>
        <van-field
          v-model="username"
          name="用户名"
          label="用户名"
          placeholder="用户名"
          :rules="[{ required: true, message: '请填写用户名' }]"
        />
        <van-field
          v-model="password"
          type="password"
          name="密码"
          label="密码"
          placeholder="密码"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
      </van-cell-group>
      <div style="margin: 16px;">
        <van-button round block type="primary" native-type="submit">
          注册
    </van-button>
  </div>
    </van-form>
    <router-link to="/login" class="register" tag="div">去登录</router-link>
  </div>
</template>

<script>


export default {
  data() {
    return {
      //用户名
      username: '',
      //用户密码
      password: ''
    }
  },
  methods: {
    //点击按钮提交
    onSubmit(values){
      console.log('submit', values);
    },
    //返回上一级
    goBack() {
      window.history.go(-1)
    }
  }
}
</script>

<style lang="scss" scoped>
.login {
  position: fixed;
  top: 0rem;
  left: 0;
  width: 100%;
  z-index: 16;
  .pic {
    height: 4rem;
    width: 100%;
    background-color: rgb(74, 142, 206);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    .icon-arrow-left-bold {
      color: #fff;
      font-size: .5rem;
      position: absolute;
      left: .3rem;
      top: .2rem
    }
    img {
      width: 3rem;
      height: 3rem;
      border-radius: 50%;
    }
  }
  .register {
    position: absolute;
    width: .8rem;
    border-bottom: 1px solid red;
    color: red;
    right: .5rem;
  }
}
button {
  background-color: orange;
  border:none
};
</style>